﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyPayDemo.WeiPay
{
    /// <summary>
    /// 请求分帐
    /// </summary>
    public class ExcuteMpos:IFunction
    {
        public override void Execute()
        {
            M_LedgerMpos request = new M_LedgerMpos();

            request.orgId = WeiPayConfig.orgId;
            request.orgMerCode = WeiPayConfig.orgMercode;
            request.orgTermNo = WeiPayConfig.orgTermno;
            request.signType = WeiPayConfig.SIGN_TYPE_RSA256;

            request.orgTrace = WeiPayUtils.GetOrgTrace(WeiPayConfig.orgId);

            M_LedgerMpos.Bizdata dataBean = new M_LedgerMpos.Bizdata();
            dataBean.oriOrgTrace = "ORG0005320211016071139531569";

            request.bizData = dataBean;
            var chkStr = WeiPayUtils.GetSignData<M_LedgerMpos.Bizdata>(dataBean);
            string sign = EncryptionUtil.RSASignJavaBouncyCastle(chkStr.ToString(), WeiPayConfig.PrivateKey, "SHA256withRSA");

            request.sign = sign;
            var result = HttpPost<M_LedgerMpos>(WeiPayConfig.ApiUrlMpos, request);


        }

        
    }
}
